//
//  JPNewFeatureSV.m
//  JPKY
//
//  Created by 吴俊杰 on 2016/11/17.
//  Copyright © 2016年 Vitas. All rights reserved.
//

#import "JPNewFeatureSV.h"

@implementation JPNewFeatureSV

- (instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        [self setupSubviews];
    }
    return self;
}

/**
 设置子视图
 */
- (void)setupSubviews{
    
    // 创建图片框
    CGFloat imgY = 0;
    CGFloat imgW = self.bounds.size.width;
    CGFloat imgH = self.bounds.size.height;
    
    for (int i = 0; i < 4; i++) {
        
        CGFloat imgX = imgW * i;
        UIImageView *iv = [[UIImageView alloc] initWithFrame:CGRectMake(imgX, imgY, imgW, imgH)];
        iv.backgroundColor = [UIColor colorWithRed:arc4random_uniform(256) / 255.0 green:arc4random_uniform(256) / 255.0 blue:arc4random_uniform(256) / 255.0 alpha:1.0];
        
        [iv setImage:[UIImage imageNamed:[NSString stringWithFormat:@"new%d",i + 1]]];
        
        [self addSubview:iv];
    }
    
    // 设置界面属性
    self.contentSize = CGSizeMake(imgW * 5, 0);
    self.pagingEnabled = YES;
    self.bounces = NO;
    self.showsVerticalScrollIndicator = NO;
    self.showsHorizontalScrollIndicator = NO;
}

@end
